<!DOCTYPE HTML>
<meta charset=utf-8>
<title>Long Animation Frame Timing: stream promise resolvers</title>
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/utils.js"></script>

<body>
<h1>Long Animation Frame: stream promise resolvers</h1>
<div id="log"></div>
<script>

test_promise_script(async t => {
    const response = await fetch("/common/dummy.xml");
    await response.body.getReader().read();
    busy_wait(very_long_frame_duration);
}, "resolve", "ReadableStreamDefaultReader.read.then");

test_promise_script(async t => {
    const response = await fetch("/common/dummy.xml");
    await response.body.getReader({ mode: "byob" }).read(new Int32Array(1000));
    busy_wait(very_long_frame_duration);
}, "resolve", "ReadableStreamBYOBReader.read.then");

test_promise_script(async t => {
    const response = await fetch("/common/dummy.xml");
    const {readable, writable} = new TransformStream({
      start() {},
      transform() {
        busy_wait(very_long_frame_duration);
      }
    });
    response.body.pipeTo(writable);
    await readable.getReader().read();
}, "resolve", "StreamPromise.resolve");
</script>
</body>
